package com.qian.service.ddj.entity;

import com.yaowk.service.common.BaseEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Set;

@Getter
@Setter
@ToString
@Entity
@DynamicUpdate
@DynamicInsert
public class DdjBusiness extends BaseEntity<Integer> {

    @Column(nullable = false)
    private String secretKey; // 秘钥
    @Column(nullable = false)
    private String account; // 商户号
    @ColumnDefault("0")
    @Column(nullable = false)
    private Byte status; // 状态
    @ColumnDefault("0")
    private BigDecimal beginMoney; // 起始金额
    @ColumnDefault("0")
    private BigDecimal endMoney; // 终止金额
    private String name;
    private String backup1; // 备用字段
    private String backup2;
    private String backup3;
    private String backup4;
    private String backup5;
    @Column(insertable = false, updatable = false)
    private Integer groupId;
    @Column(insertable = false, updatable = false)
    private Integer businessCardId;

    private String remark; // 备注

    @ColumnDefault("0")
    private BigDecimal balance;


    @ManyToOne
    @JoinColumn(name = "groupId")
    private DdjBusinessGroup businessGroup;

    @ManyToMany(mappedBy = "businesses")
    private Set<DdjUser> users;

    @ManyToOne
    @JoinColumn(name = "businessCardId")
    private DdjBusinessCard businessCard;


}
